﻿@using Microsoft.AspNetCore.Components.Web
@using North.Common
@using North.Core.Common;
@using North.Pages.Auth

@namespace North.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

@inject AppSetting _appSetting

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <base href="~/" />
        <!-- 标签栏图标 -->
        <link rel="shortcut icon" href="@_appSetting.Appearance.Icon" type="image/x-icon"/>
        <link href="North.styles.css" rel="stylesheet" />
        <component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
    </head>
    <body>
        @RenderBody()
        <script src="_framework/blazor.server.js"></script>
        <!-- 注册自定义 pastemultimedia 事件 -->
        <script>
            Blazor.registerCustomEventType("pastemultimedia", {
                browserEventName: 'paste',
                createEventArgs: event => {
                    let data = [];
                    let isMultimedia = false;
                    
                    const text = event.clipboardData.getData('text');
                    if(text != ""){
                        data.push(text);
                    }
                    else{
                        isMultimedia = true;

                        const items = event.clipboardData.items;
                        for (let i = 0; i < items.length; i++) {
                            const file = items[i].getAsFile();
                            if (!file) {
                                continue;
                            }
                            data.push(`${items[i].type}&${URL.createObjectURL(file)}`);
                        }
                    }

                    return {
                        isMultimedia,
                        data
                    }
                }
            })
        </script>
    </body>
</html>

<style>
    html, body {
        width:100%;
        height: 100%;
        margin:0;
        padding:0;
    }
</style>